<template>
	<view>
		<view style="padding: 10px 20px;">
			<uni-forms ref="form" :model="form" :rules="rules">
				<uni-forms-item label="名称" name="nickname" label-width="90px">
					<uni-easyinput v-model="form.nickname" placeholder=" " />
				</uni-forms-item>
				<uni-forms-item label="头像" name="avatar_img" label-width="90px">
					<ImgUpload v-model="form.avatar_img" :max="1"/>
				</uni-forms-item>
				<uni-forms-item label="电话" name="tel" label-width="90px">
					<uni-easyinput v-model="form.tel" placeholder=" " />
				</uni-forms-item>
			
			</uni-forms>
			<view class="btn-primary" @click="submit" style="margin-top: 30px;">保存</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form:{
				}
			}
		},
		onShow() {
			this.getData()
		},
		methods: {
			getData(){
				this.get('user/user_info').then(({code,user_info})=>{
					if(code==1){
						this.form=user_info
					}
				})
			},
			submit(){
				this.post('crud/save',{...this.form,table:'user'}).then(({code})=>{
					if(code==1){
						this.success('保存成功!')
					}
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
